package com.pingan.haofang.searchcloud.batch.config;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
import org.springframework.scheduling.config.TaskManagementConfigUtils;

import com.pingan.haofang.searchcloud.batch.common.ScheduleCondition;

/**
 * 批处理任务
 *
 * @author ZHANGBI617
 * @version 1.0.0
 * @date 2017年2月20日
 * @since 1.0.0
 */
@Configuration
public class BatchBeanConfiguration {

    @Conditional(ScheduleCondition.class)
    @Bean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
    @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
    public ScheduledAnnotationBeanPostProcessor scheduledAnnotationProcessor() {
        return new ScheduledAnnotationBeanPostProcessor();
    }

}
